using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialStatisticsTools._ModelingSpatialRelationships
{
    /// <summary>
    /// <para>Generate Network Spatial Weights</para>
    /// <para>Constructs a spatial weights matrix file (.swm) using a network dataset, defining spatial relationships in terms of the underlying network structure.</para>
    /// <para>使用网络数据集构建空间权重矩阵文件 （.swm），根据底层网络结构定义空间关系。</para>
    /// </summary>    
    [DisplayName("Generate Network Spatial Weights")]
    public class GenerateNetworkSWM : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public GenerateNetworkSWM()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_Input_Feature_Class">
        /// <para>Input Feature Class</para>
        /// <para>The point feature class representing locations on the network. For each feature, neighbors and weights are calculated and stored in the output spatial weights matrix file.</para>
        /// <para>表示网络上位置的点要素类。对于每个要素，将计算邻域和权重并将其存储在输出空间权重矩阵文件中。</para>
        /// </param>
        /// <param name="_Unique_ID_Field">
        /// <para>Unique ID Field</para>
        /// <para>An integer field containing a unique value for each feature in the input feature class. If you don't have a field with unique ID values, you can create one by adding an integer field to your feature class table and calculating the field values to equal the FID or OBJECTID field.</para>
        /// <para>一个整数字段，其中包含输入要素类中每个要素的唯一值。如果没有具有唯一 ID 值的字段，则可以通过向要素类表添加整数字段并计算字段值以等于 FID 或 OBJECTID 字段来创建一个字段。</para>
        /// </param>
        /// <param name="_Output_Spatial_Weights_Matrix_File">
        /// <para>Output Spatial Weights Matrix File</para>
        /// <para>The output network spatial weights matrix file (.swm) that will store the neighbors and weights for each input feature.</para>
        /// <para>输出网络空间权重矩阵文件 （.swm），用于存储每个输入要素的相邻要素和权重。</para>
        /// </param>
        /// <param name="_Input_Network_Data_Source">
        /// <para>Input Network Data Source</para>
        /// <para>The network dataset used to find neighbors of each input feature. Network datasets usually represent street networks but can also represent other kinds of transportation networks such as railroads or walking paths. The network dataset must include at least one attribute related to distance, travel time, or cost.</para>
        /// <para>用于查找每个输入要素的相邻点的网络数据集。网络数据集通常表示街道网络，但也可以表示其他类型的交通网络，例如铁路或步行道。网络数据集必须至少包含一个与距离、行驶时间或成本相关的属性。</para>
        /// </param>
        /// <param name="_Travel_Mode">
        /// <para>Travel Mode</para>
        /// <para>The mode of transportation for the analysis. A travel mode defines how a pedestrian, car, truck, or other medium of transportation moves through the network and represents a collection of network settings, such as travel restrictions and U-turn policies.</para>
        /// <para>用于分析的运输方式。出行模式定义行人、汽车、卡车或其他交通工具在网络中的移动方式，并表示网络设置的集合，例如旅行限制和 U 形转弯策略。</para>
        /// </param>
        public GenerateNetworkSWM(object _Input_Feature_Class, object _Unique_ID_Field, object _Output_Spatial_Weights_Matrix_File, object _Input_Network_Data_Source, object _Travel_Mode)
        {
            this._Input_Feature_Class = _Input_Feature_Class;
            this._Unique_ID_Field = _Unique_ID_Field;
            this._Output_Spatial_Weights_Matrix_File = _Output_Spatial_Weights_Matrix_File;
            this._Input_Network_Data_Source = _Input_Network_Data_Source;
            this._Travel_Mode = _Travel_Mode;
        }
        public override string ToolboxName => "Spatial Statistics Tools";

        public override string ToolName => "Generate Network Spatial Weights";

        public override string CallName => "stats.GenerateNetworkSWM";

        public override List<string> AcceptEnvironments => ["extent", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_Input_Feature_Class, _Unique_ID_Field, _Output_Spatial_Weights_Matrix_File, _Input_Network_Data_Source, _Travel_Mode, _Impedance_Distance_Cutoff, _Impedance_Temporal_Cutoff, _Impedance_Cost_Cutoff, _Maximum_Number_of_Neighbors, _Time_of_Day, _Time_Zone.GetGPValue(), _Barriers, _Search_Tolerance, _Conceptualization_of_Spatial_Relationships.GetGPValue(), _Exponent, _Row_Standardization.GetGPValue()];

        /// <summary>
        /// <para>Input Feature Class</para>
        /// <para>The point feature class representing locations on the network. For each feature, neighbors and weights are calculated and stored in the output spatial weights matrix file.</para>
        /// <para>表示网络上位置的点要素类。对于每个要素，将计算邻域和权重并将其存储在输出空间权重矩阵文件中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Feature Class")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Input_Feature_Class { get; set; }


        /// <summary>
        /// <para>Unique ID Field</para>
        /// <para>An integer field containing a unique value for each feature in the input feature class. If you don't have a field with unique ID values, you can create one by adding an integer field to your feature class table and calculating the field values to equal the FID or OBJECTID field.</para>
        /// <para>一个整数字段，其中包含输入要素类中每个要素的唯一值。如果没有具有唯一 ID 值的字段，则可以通过向要素类表添加整数字段并计算字段值以等于 FID 或 OBJECTID 字段来创建一个字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Unique ID Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Unique_ID_Field { get; set; }


        /// <summary>
        /// <para>Output Spatial Weights Matrix File</para>
        /// <para>The output network spatial weights matrix file (.swm) that will store the neighbors and weights for each input feature.</para>
        /// <para>输出网络空间权重矩阵文件 （.swm），用于存储每个输入要素的相邻要素和权重。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Spatial Weights Matrix File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Output_Spatial_Weights_Matrix_File { get; set; }


        /// <summary>
        /// <para>Input Network Data Source</para>
        /// <para>The network dataset used to find neighbors of each input feature. Network datasets usually represent street networks but can also represent other kinds of transportation networks such as railroads or walking paths. The network dataset must include at least one attribute related to distance, travel time, or cost.</para>
        /// <para>用于查找每个输入要素的相邻点的网络数据集。网络数据集通常表示街道网络，但也可以表示其他类型的交通网络，例如铁路或步行道。网络数据集必须至少包含一个与距离、行驶时间或成本相关的属性。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Network Data Source")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Input_Network_Data_Source { get; set; }


        /// <summary>
        /// <para>Travel Mode</para>
        /// <para>The mode of transportation for the analysis. A travel mode defines how a pedestrian, car, truck, or other medium of transportation moves through the network and represents a collection of network settings, such as travel restrictions and U-turn policies.</para>
        /// <para>用于分析的运输方式。出行模式定义行人、汽车、卡车或其他交通工具在网络中的移动方式，并表示网络设置的集合，例如旅行限制和 U 形转弯策略。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Travel Mode")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Travel_Mode { get; set; }


        /// <summary>
        /// <para>Impedance Distance Cutoff</para>
        /// <para>The maximum impedance distance allowed for neighbors of a feature. Any feature whose distance is farther than this value will not be used as a neighbor. By default, no distance cutoff is used.</para>
        /// <para>要素的邻居允许的最大阻抗距离。任何距离远于此值的要素都不会用作邻居。默认情况下，不使用距离截止。</para>
        /// <para>单位： Feet | Meters | Kilometers | Miles </para>
        /// </summary>
        [DisplayName("Impedance Distance Cutoff")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string? _Impedance_Distance_Cutoff { get; set; } = null;


        /// <summary>
        /// <para>Impedance Temporal Cutoff</para>
        /// <para>The maximum impedance travel time allowed for neighbors of a feature. Any feature whose travel time is longer than this value will not be used as a neighbor. By default, no temporal cutoff is used.</para>
        /// <para>要素的邻居允许的最大阻抗传播时间。任何旅行时间长于此值的要素都不会用作邻居。默认情况下，不使用时间截止。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Impedance Temporal Cutoff")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Impedance_Temporal_Cutoff { get; set; } = null;


        /// <summary>
        /// <para>Impedance Cost Cutoff</para>
        /// <para>The maximum impedance cost allowed for neighbors of a feature. Any feature whose cost of travel is larger than this value will not be used as a neighbor. By default, no cost cutoff is used.</para>
        /// <para>要素的邻居允许的最大阻抗成本。任何旅行成本大于此值的要素都不会用作邻居。默认情况下，不使用成本截止值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Impedance Cost Cutoff")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _Impedance_Cost_Cutoff { get; set; } = null;


        /// <summary>
        /// <para>Maximum Number of Neighbors</para>
        /// <para>An integer reflecting the maximum number of neighbors for each feature. The actual number of neighbors used for each feature may be smaller due to impedance cutoffs.</para>
        /// <para>反映每个要素的最大相邻点数的整数。由于阻抗截止，用于每个特征的实际邻居数可能较小。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Number of Neighbors")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _Maximum_Number_of_Neighbors { get; set; } = null;


        /// <summary>
        /// <para>Time of Day</para>
        /// <para><xdoc>
        ///   <para>The time of day traffic conditions will be considered in the analysis. Traffic conditions can impact the distance that can be traveled over a given time. If no date or time is provided, the analysis will not consider the impact of traffic.</para>
        ///   <para>Instead of using a particular date, you can specify a day of the week using the following dates:</para>
        ///   <para>
        ///     <bulletList>
        ///       <bullet_item>Today-12/30/1899</bullet_item><para/>
        ///       <bullet_item>Sunday-12/31/1899</bullet_item><para/>
        ///       <bullet_item>Monday-1/1/1900</bullet_item><para/>
        ///       <bullet_item>Tuesday-1/2/1900</bullet_item><para/>
        ///       <bullet_item>Wednesday-1/3/1900</bullet_item><para/>
        ///       <bullet_item>Thursday-1/4/1900</bullet_item><para/>
        ///       <bullet_item>Friday-1/5/1900</bullet_item><para/>
        ///       <bullet_item>Saturday-1/6/1900</bullet_item><para/>
        ///     </bulletList>
        ///   </para>
        ///   <para>For example, to specify that travel should begin at 5:00 p.m. on Tuesday, specify the parameter value as 1/2/1900 5:00 PM.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>分析中将考虑一天中的时间交通状况。交通状况会影响在给定时间内可以行驶的距离。如果未提供日期或时间，则分析将不考虑流量的影响。</para>
        ///   <para>您可以使用以下日期指定星期几，而不是使用特定日期：</para>
        ///   <para>
        ///     <bulletList>
        ///       <bullet_item>今天-1899/12/30</bullet_item><para/>
        ///       <bullet_item>星期日-12/31/1899</bullet_item><para/>
        ///       <bullet_item>星期一-1/1/1900</bullet_item><para/>
        ///       <bullet_item>星期二-1/2/1900</bullet_item><para/>
        ///       <bullet_item>星期三-1/3/1900</bullet_item><para/>
        ///       <bullet_item>星期四-1/4/1900</bullet_item><para/>
        ///       <bullet_item>星期五-1/5/1900</bullet_item><para/>
        ///       <bullet_item>星期六-1/6/1900</bullet_item><para/>
        ///     </bulletList>
        ///   </para>
        ///   <para>例如，若要指定旅行应从星期二下午 5：00 开始，请将参数值指定为 1/2/1900 下午 5：00。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time of Day")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Time_of_Day { get; set; } = null;


        /// <summary>
        /// <para>Time Zone</para>
        /// <para><xdoc>
        ///   <para>Specifies the time zone for the Time of Day parameter.</para>
        ///   <bulletList>
        ///     <bullet_item>Local time at locations—The time zone in which the Input Feature Class is located will be used. This is the default.</bullet_item><para/>
        ///     <bullet_item>UTC—Coordinated universal time (UTC) will be used.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定“时间”参数的时区。</para>
        ///   <bulletList>
        ///     <bullet_item>位置的本地时间—将使用输入要素类所在的时区。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>UTC—将使用协调世界时 （UTC）。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Time Zone")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _Time_Zone_value _Time_Zone { get; set; } = _Time_Zone_value._LOCAL_TIME_AT_LOCATIONS;

        public enum _Time_Zone_value
        {
            /// <summary>
            /// <para>Local time at locations</para>
            /// <para>Local time at locations—The time zone in which the Input Feature Class is located will be used. This is the default.</para>
            /// <para>位置的本地时间—将使用输入要素类所在的时区。这是默认设置。</para>
            /// </summary>
            [Description("Local time at locations")]
            [GPEnumValue("LOCAL_TIME_AT_LOCATIONS")]
            _LOCAL_TIME_AT_LOCATIONS,

            /// <summary>
            /// <para>UTC</para>
            /// <para>UTC—Coordinated universal time (UTC) will be used.</para>
            /// <para>UTC—将使用协调世界时 （UTC）。</para>
            /// </summary>
            [Description("UTC")]
            [GPEnumValue("UTC")]
            _UTC,

        }

        /// <summary>
        /// <para>Barriers</para>
        /// <para>The features that represent blocked intersections, road closures, accident sites, or other locations where travel is blocked along the network.</para>
        /// <para>表示网络上交通受阻的交叉路口、道路封闭、事故现场或其他出行受阻位置的要素。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Barriers")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Barriers { get; set; } = null;


        /// <summary>
        /// <para>Search Tolerance</para>
        /// <para>The maximum distance used to assign each input feature to a location on the network. If any of the input points do not fall exactly on a line of the network, they will be assigned to the closest location on the network for the analysis. However, if the feature is farther than the search tolerance value from any location on the network, it will not be assigned to the network and will not be included in the analysis.</para>
        /// <para>用于将每个输入要素分配给网络上某个位置的最大距离。如果任何输入点不完全落在网络的一条线上，则它们将被分配到网络上最近的位置进行分析。但是，如果要素距离网络上任何位置的搜索容差值更远，则不会将其分配给网络，也不会包含在分析中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Search Tolerance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public string _Search_Tolerance { get; set; } = "5000 Meters";


        /// <summary>
        /// <para>Conceptualization of Spatial Relationships</para>
        /// <para><xdoc>
        ///   <para>Specifies how weights will be defined for each neighbor.</para>
        ///   <bulletList>
        ///     <bullet_item>Inverse—Features farther in distance, time, or cost will have a smaller weight than features nearby. The weights decrease by their inverse to an exponent.</bullet_item><para/>
        ///     <bullet_item>Fixed—All neighbors will be given equal weight. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何定义每个邻居的权重。</para>
        ///   <bulletList>
        ///     <bullet_item>反转 - 距离、时间或成本较远的要素的权重将小于附近的要素。权重减小，与指数成反比。</bullet_item><para/>
        ///     <bullet_item>固定 - 将赋予所有邻居相同的权重。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Conceptualization of Spatial Relationships")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _Conceptualization_of_Spatial_Relationships_value _Conceptualization_of_Spatial_Relationships { get; set; } = _Conceptualization_of_Spatial_Relationships_value._FIXED;

        public enum _Conceptualization_of_Spatial_Relationships_value
        {
            /// <summary>
            /// <para>Fixed</para>
            /// <para>Fixed—All neighbors will be given equal weight. This is the default.</para>
            /// <para>固定 - 将赋予所有邻居相同的权重。这是默认设置。</para>
            /// </summary>
            [Description("Fixed")]
            [GPEnumValue("FIXED")]
            _FIXED,

            /// <summary>
            /// <para>Inverse</para>
            /// <para>Inverse—Features farther in distance, time, or cost will have a smaller weight than features nearby. The weights decrease by their inverse to an exponent.</para>
            /// <para>反转 - 距离、时间或成本较远的要素的权重将小于附近的要素。权重减小，与指数成反比。</para>
            /// </summary>
            [Description("Inverse")]
            [GPEnumValue("INVERSE")]
            _INVERSE,

        }

        /// <summary>
        /// <para>Exponent</para>
        /// <para>The exponent used when Inverse is specified for the Conceptualization of Spatial Relationships parameter. The weights assigned to each neighbor are calculated by taking the inverse distance, time, or cost to the power of the exponent. The default value is 1, and the value must be between 0.01 and 4. Weights drop off more rapidly as the exponent increases.</para>
        /// <para>为空间关系概念化参数指定 Inverse 时使用的指数。分配给每个邻居的权重是通过将反距离、时间或成本与指数的幂相等来计算的。默认值为 1，该值必须介于 0.01 和 4 之间。随着指数的增加，权重下降得更快。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Exponent")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _Exponent { get; set; } = 1;


        /// <summary>
        /// <para>Row Standardization</para>
        /// <para><xdoc>
        ///   <para>Specifies whether row standardization will be applied. Row standardization is recommended when the locations of the input points are potentially biased due to sampling design or an imposed aggregation scheme. It is also recommended that you standardize rows when weighting neighbors based on inverse distance, time, or cost.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Spatial weights will be standardized by row. Each weight is divided by its row sum. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—No standardization of spatial weights will be applied.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否应用行标准化。当输入点的位置由于采样设计或强加的聚合方案而可能存在偏差时，建议进行行标准化。此外，还建议您在根据反距离、时间或成本对相邻点进行加权时对行进行标准化。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 空间权重将按行进行标准化。每个权重除以其行总和。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中—不会应用空间权重的标准化。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Row Standardization")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _Row_Standardization_value _Row_Standardization { get; set; } = _Row_Standardization_value._true;

        public enum _Row_Standardization_value
        {
            /// <summary>
            /// <para>ROW_STANDARDIZATION</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ROW_STANDARDIZATION")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_STANDARDIZATION</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_STANDARDIZATION")]
            [GPEnumValue("false")]
            _false,

        }

        public GenerateNetworkSWM SetEnv(object extent = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(extent: extent, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}